package com.thz.common.enums;

import lombok.Getter;

/**
 * 转换状态枚举
 * 
 * @author THZ
 * @date 2025
 */
@Getter
public enum ConversionStatus {
    
    /**
     * 待转换
     */
    PENDING(0, "待转换"),
    
    /**
     * 转换中
     */
    CONVERTING(1, "转换中"),
    
    /**
     * 转换成功
     */
    SUCCESS(2, "转换成功"),
    
    /**
     * 转换失败
     */
    FAILED(3, "转换失败");
    
    private final Integer code;
    private final String message;
    
    ConversionStatus(Integer code, String message) {
        this.code = code;
        this.message = message;
    }
    
    /**
     * 根据代码获取枚举
     */
    public static ConversionStatus fromCode(Integer code) {
        if (code == null) {
            return null;
        }
        for (ConversionStatus status : values()) {
            if (status.getCode().equals(code)) {
                return status;
            }
        }
        throw new IllegalArgumentException("未知的转换状态: " + code);
    }
    
    /**
     * 获取描述信息
     */
    public String getDescription() {
        return this.message;
    }
}




